<!DOCTYPE HTML>
<html>
<head>
   <meta charset="utf-8"/>
   <title>innerHTML</title>
<style>
    
    #div1{
   	   width:200px;height:200px;border:1px solid black;
    }
</style>
<script>
    window.onload = function(){
    	var oTxt = document.getElementById('txt1');
    	var oBtn = document.getElementById('btn1');
    	var oDiv = document.getElementById('div1');

    	oBtn.onclick = function(){
    		oDiv.innerHTML=oTxt.value;
    	}
    }
</script>
</head>
<body>
    <input id="txt1" type="text"/>
    <input id="btn1" type="button" value="设置文字">
    <div id="div1"></div>
</body>
</html>



























